﻿using System;
using System.Collections.Generic;
using System.Text;
using Avalonia;
using Avalonia.Controls;
using Avalonia.Data;
using Avalonia.Interactivity;
using Avalonia.Media;
using Avalonia.Media.Imaging;

namespace AvaloniaApplication1.Controls
{
    public class CornerRadiusButton : Button
    {

        public static readonly StyledProperty<CornerRadius> CornerRadiusProperty = AvaloniaProperty.Register<CornerRadiusButton, CornerRadius>(nameof(CornerRadius));

        /// <summary>
        /// Gets or sets the radius of the border rounded corners.
        /// </summary>
        public CornerRadius CornerRadius
        {
            get
            {
                return this.GetValue<CornerRadius>((AvaloniaProperty<CornerRadius>)CornerRadiusButton.CornerRadiusProperty);
            }
            set
            {
                this.SetValue<CornerRadius>((AvaloniaProperty<CornerRadius>)CornerRadiusButton.CornerRadiusProperty, value, BindingPriority.LocalValue);
            }
        }

        /// <summary>
        ///文本修剪
        /// </summary>
        public static readonly StyledProperty<TextTrimming> TextTrimmingProperty = AvaloniaProperty.Register<CornerRadiusButton, TextTrimming>(nameof(TextTrimming));

        /// <summary>
        ///文本修剪
        /// </summary>
        public TextTrimming TextTrimming
        {
            get { return GetValue(TextTrimmingProperty); }
            set { SetValue(TextTrimmingProperty, value); }
        }

        /// <summary>
        ///文本修剪
        /// </summary>
        public static readonly StyledProperty<IBrush> HoverBrushProperty = AvaloniaProperty.Register<CornerRadiusButton, IBrush>(nameof(HoverBrush));

        /// <summary>
        /// 鼠标悬浮颜色
        /// </summary>
        public IBrush HoverBrush
        {
            get => this.GetValue<IBrush>((StyledPropertyBase<IBrush>)CornerRadiusButton.HoverBrushProperty);
            set => this.SetValue<IBrush>((StyledPropertyBase<IBrush>)CornerRadiusButton.HoverBrushProperty, value, BindingPriority.LocalValue);
        }


    }
}
